cmake_minimum_required(VERSION 2.8)
Project(1Drichrards)

## verbose compiling
set( CMAKE_VERBOSE_MAKEFILE on )

## the path to find cmake modules
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)


## find the required packages
# FIND_PACKAGE(GSL REQUIRED)
# FIND_PACKAGE(LAPACK REQUIRED)

## -I
## where to look for headers:
# include_directories(${GSL_INCLUDE_DIRS} ${PROJET_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/include)

## print all warnings
ADD_DEFINITIONS(-Wall)

## optimize program
ADD_DEFINITIONS(-O2)

## add debug support
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -I/usr/include/plplot")

## list of the source files
set(SOURCES
 "./main.c"
 "./rhomx.c"
 "./richalgo.c"
	"./spline.c"
	"./regularisation.c"
	"./materialfunction.c"
	"./sign.c"
	"./solve.c"
	"./CGSolver.c"
	"./FDmatrix.c"
	"./richalgo.c"

)

## list of the header files
set(HEADERS
	
	"./richalgo.h"
	"./rhomx.h"
	"./spline.h"
	"./regularisation.h"
	"./materialfunction.h"
	"./sign.h"
	"./solve.h"
	"./CGSolver.h"
	"./FDmatrix.h"
	"./richalgo.h"

)

# -L
# where to look for libraries
# LINK_LIBRARIES(${PROJECT_SOURCE_DIR}lib/liblapack.a)
# add_library(lib/lapack)
LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib)
LINK_DIRECTORIES(/usr/lib)
LINK_DIRECTORIES(/usr/local/lib)

## target program
add_executable(test_program ${SOURCES} ${HEADERS})

# How to get the correct header and linker options?
# pkg-config --cflags plplotd
# pkg-config --libs plplotd

## link against libraries (after compiling)
#target_link_libraries(test_program gsl gslcblas lapack_atlas lapack m)
#target_link_libraries(test_program lapack_local blas_local f2c_local m)
target_link_libraries(test_program lapack_local blas_local f2c_local plplotd ltdl dl csirocsa csironn qhull qsastime freetype m)
